import { Component } from 'react'
import Taro from '@tarojs/taro'
import { Image, View,} from '@tarojs/components'
import { connect } from 'react-redux'
import { Button} from '@antmjs/vantui'
import { LoadStudentActionAsync,DeleteStudentActionAsync,AddStudentActionAsync} from '../../redux/action/studentAction';
import { ChangeLoadingAction } from '../../redux/action/loadingAction';
import Loading from '../../components/Loading/index'
import dev from '../../../config/dev';
import './index.less'

const isH5 = process.env.TARO_ENV === 'h5'

@connect(	state => ({
    studentList:state.studentList
	}),
	{LoadStudentActionAsync,DeleteStudentActionAsync,AddStudentActionAsync,ChangeLoadingAction}
)
class OrderSuccess extends Component {
  state={
    // list:[1,2,3,4,5,6,7,8],
    // chooseIndex:2,
    // flag:false
  }

  // UNSAFE_componentWillMount () { console.log('UNSAFE_componentWillMount,组件还没挂载前');if(isH5){console.log('你当前环境为H5')} }

  // componentDidMount () { console.log('componentDidMount,组件挂载后');}

  // shouldComponentUpdate (nextProps,nextState) { console.log('shouldComponentUpdate,组件是否需要更新',nextProps,nextState);return true }

  // componentWillUnmount () { console.log('componentWillUnmount,组件卸载前') }

  // componentDidShow () { console.log('componentDidShow,组件显示后') }

  // componentDidHide () { console.log('componentDidHide,组件隐藏后') }

    // onLoad
  onLoad (options) {
    // scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
    // const scene = decodeURIComponent(options.scene)
    // console.log(scene)
    this.setState({orderId:options.orderId})
  }

  // onReady
  onReady () {}

  // 对应 onShow
  componentDidShow () {}

  // 对应 onHide
  componentDidHide () {}

  // 对应 onPullDownRefresh，除了 componentDidShow/componentDidHide 之外，
  // 所有页面生命周期函数名都与小程序相对应
  onPullDownRefresh () {}

  render () {
    return (
      <View style={{height:'100vh',padding:'0 40rpx'}}>
        <Loading></Loading>
        <Image
          style={{width:'452rpx',height:'484rpx',position:'absolute',top:'15%',left:'50%',zIndex:'-1',transform:'translateX(-50%)'}}
          src=''
        />
        <View
          style={{fontSize:'40rpx',position:'absolute',top:'50%',left:'50%',zIndex:'-1',transform:'translateX(-50%)'}}
        >下单成功</View>
        <Button
          style={{height:'100rpx',color:'#583ef2',backgroundColor:'#f4f3fd',width:'500rpx',fontSize:'30rpx',position:'absolute',top:'60%',left:'50%',zIndex:'0',transform:'translateX(-50%)'}}
          onClick={()=>{
            let that=this
            Taro.reLaunch({
              url: '/pages/orderDetailed/index?orderId='+that.state.orderId
            })
          }}
        >订单详情</Button>
        <Button
          style={{height:'100rpx',color:'red',backgroundColor:'#ffebf0',width:'500rpx',fontSize:'30rpx',position:'absolute',top:'68%',left:'50%',zIndex:'0',transform:'translateX(-50%)'}}
          onClick={()=>{
            Taro.reLaunch({
              url: '/pages/one/index'
            })
          }}
        >返回首页</Button>
      </View>
    )
  }
}
OrderSuccess.defaultProps = {}
export default OrderSuccess

